import Vue from "vue";
import VueRouter from "vue-router";
import Main from "../views/main.vue";
//注册路由
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Main",
    component: Main,
    redirect: "/index",
    children: [
      {
        path: "index",
        name: "index",
        component: () => import("../views/main/index.vue"),
      },
      {
        path: "category",
        name: "category",
        component: () => import("../views/main/category.vue"),
      },
      {
        path: "like",
        name: "like",
        component: () => import("../views/main/like.vue"),
      },
      {
        path: "home",
        name: "home",
        component: () => import("../views/main/home.vue"),
      },
    ],
  },
  {
    path: "/Login",
    name: "Login",
    component: () => import("../views/Login.vue"),
  },
  {
    path: "/Enroll",
    name: "Enroll",
    component: () => import("../views/Enroll.vue"),
  },
  {
    path: "/goodinfo",
    name: "goodinfo",
    component: () => import("../views/goodinfo.vue"),
  },
  {
    path: "/404",
    name: "404",
    component: () => import("../views/404.vue"),
  },
];
// 实例化路由
const router = new VueRouter({
  routes,
});
//导出路由对象
export default router;
